package com.domi.route;

import org.springframework.cloud.gateway.event.RefreshRoutesEvent;
import org.springframework.cloud.gateway.route.Route;
import org.springframework.cloud.gateway.route.RouteLocator;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.context.ApplicationEventPublisherAware;
import org.springframework.context.ApplicationListener;
import org.springframework.core.Ordered;
import reactor.core.publisher.Flux;

import java.util.ArrayList;

public class RefreshRouteLocator implements Ordered, RouteLocator, ApplicationListener<RefreshRoutesEvent>, ApplicationEventPublisherAware {

    @Override
    public Flux<Route> getRoutes() {
        return Flux.fromIterable(new ArrayList<>());
    }

    @Override
    public void setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher) {

    }

    @Override
    public void onApplicationEvent(RefreshRoutesEvent event) {

    }

    @Override
    public int getOrder() {
        return 0;
    }
}
